home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: void main() and other atrocities!
- Date: Tue, 06 Feb 96 13:17:06 GMT
- Organization: none
- Message-ID: <823612626snz@genesis.demon.co.uk>
- References: <4eduaj$1aq@grouper.Exis.Net> <4em17r$shq@jaxnet.jaxnet.com> <4emub9$1mo@fountain.mindlink.net> <4epplj$egf@host-3.cyberhighway.net> <4erjn2INN38b@keats.ugrad.cs.ubc.ca> <9602021300.AA04359@dxmint.cern.ch> <4f5vc2$qcj@cdn_news.telecom.com.au>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <4f5vc2$qcj@cdn_news.telecom.com.au>
- jolson@vprpmel1.telecom.com.au "Jeff Olson" writes:
-
- >How about:
- >
- >int main (int argc, char **argv)
- >
- >I saw in the FAQ that a multi-dimentional array will not decay into a pointer
- >to a pointer. This main() is valid with my Sparcworks compiler so I would
- >like to know if my compiler is supporting non-standard behavior or if argv is
- >a pointer to an array of characters (meaning it can decay into a pointer to a
- >pointer).
-
- argv is correctly a pointer to a pointer. The standard writes the 2 parameter
- form of main as
-
- int main(int argc, char *argv[]) { /*...*/ }
-
- The type of argv stated here is an array of pointers to char. By the function
- parameter rewrite rule the compiler treats this exactly as if it were
- written as:
-
- int main(int argc, char **argv) { /*...*/ }
-
- However the important thing to note is that the 'argv array' is genuinely
- an array of pointers (and is not an array of arrays) so it is correct that
- argv itself is a pointer to a pointer. If you were to call main you couldn't
- legally pass it an array of arrays.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-